{% extends 'base.html' %}
{% load i18n %}
{% get_available_languages as LANGUAGES %}
{% get_current_language as CURRENT_LANGUAGE %}

{% block title %}{% trans 'Account Settings' %}{% endblock %}

{% block main %}
  <div class="page-header">
    <h1>{% trans 'Account Settings' %}</h1>
  </div>
  <div class="row" style="margin-top: 2em">
    <div class="col-md-3">
      {% include 'core/partial_settings_menu.html' with active='profile' %}
    </div>
    <div class="col-md-9">
      {% if messages %}
        {% for message in messages %}
          <div class="alert alert-success alert-dismissable">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            {{ message }}
          </div>
        {% endfor %}
      {% endif %}
      <h3 style="margin-top: 0">{% trans 'Edit Profile' %}</h3>
      <form role="form" class="form-horizontal" method="post" action="{% url 'settings' %}">
        {% csrf_token %}
        {% for field in form.visible_fields %}
          <div class="form-group{% if field.errors %} has-error{% endif %}">
            <label for="{{ field.label }}" class="col-sm-2 control-label">{{ field.label }}</label>
            <div class="col-sm-10">
              {{ field }}
              {% if field.help_text %}
                <span class="help-block">{{ field.help_text }}</span>
              {% endif %}
              {% for error in field.errors %}
                <label class="control-label">{{ error }}</label>
              {% endfor %}
            </div>
          </div>
        {% endfor %}
        {% comment %}
        <div class="form-group">
          <label for="language" class="col-sm-2 control-label">Language</label>
          <div class="col-sm-10">
            <select id="language" name="language" class="form-control">
              {% for lang in LANGUAGES %}
                <option value="{{ lang.0 }}">{{ lang.1 }}</option>
              {% endfor %}
            </select>
          </div>
        </div>
        {% endcomment %}
        <div class="form-group">
          <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary">{% trans 'Save' %}</button>
          </div>
        </div>
      </form>
    </div>
  </div>
{% endblock main %}
